package com.eva.androidlibrary.api.entity;

import android.os.Parcel;
import android.os.Parcelable;

import com.alibaba.fastjson.annotation.JSONField;

/**
 * 商品实体
 *
 * @author GUXIA318
 * @date 2015-11-26 16:32
 */
public class Product extends BaseBean implements Parcelable, Cloneable {

    /** 店铺ID */
    @JSONField(name = "shopid")
    private String shopId;

    /** 商品id */
    @JSONField(name = "productid")
    private String id;

    /** 商品名称 */
    private String name;

    /** 品类ID */
    @JSONField(name = "categoryid")
    private int categoryId;

    /** 品类名 */
    private String categoryName;

    /** 产地 */
    private String region;

    /** 价格 */
    private float price;

    /** 市场价 */
    @JSONField(name = "market_price")
    private float marketPrice;

    /** 单位 */
    private String unit;

    /** 简介 */
    @JSONField(name = "detail")
    private String intro;

    /** 封面图 */
    private String cover;

    /** 详情图 */
    private ProductImageList pics;

    /** 销量 */
    private int salesVolume;

    /** 添加时间 */
    private long addTime;

    /** 是否上架，上架：1，未上架：0 */
    private int isPublish;

    private String delivery;

    private String duration;

    @JSONField(name = "modified_at")
    private float modifiedAt;

    @JSONField(name = "created_at")
    private float createdAt;


    public String getShopId() {
        return shopId;
    }

    public void setShopId(String shopId) {
        this.shopId = shopId;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getCategoryId() {
        return categoryId;
    }

    public void setCategoryId(int categoryId) {
        this.categoryId = categoryId;
    }

    public String getCategoryName() {
        return categoryName;
    }

    public void setCategoryName(String categoryName) {
        this.categoryName = categoryName;
    }

    public String getRegion() {
        return region;
    }

    public void setRegion(String region) {
        this.region = region;
    }

    public float getPrice() {
        return price;
    }

    public void setPrice(float price) {
        this.price = price;
    }

    public float getMarketPrice() {
        return marketPrice;
    }

    public void setMarketPrice(float marketPrice) {
        this.marketPrice = marketPrice;
    }

    public String getUnit() {
        return unit;
    }

    public void setUnit(String unit) {
        this.unit = unit;
    }

    public String getIntro() {
        return intro;
    }

    public void setIntro(String intro) {
        this.intro = intro;
    }

    public String getCover() {
        return cover;
    }

    public void setCover(String cover) {
        this.cover = cover;
    }

    public ProductImageList getPics() {
        return pics;
    }

    public void setPics(ProductImageList pics) {
        this.pics = pics;
    }

    public int getSalesVolume() {
        return salesVolume;
    }

    public void setSalesVolume(int salesVolume) {
        this.salesVolume = salesVolume;
    }

    public long getAddTime() {
        return addTime;
    }

    public void setAddTime(long addTime) {
        this.addTime = addTime;
    }

    public int getIsPublish() {
        return isPublish;
    }

    public void setIsPublish(int isPublish) {
        this.isPublish = isPublish;
    }

    public String getDelivery() {
        return delivery;
    }

    public void setDelivery(String delivery) {
        this.delivery = delivery;
    }

    public String getDuration() {
        return duration;
    }

    public void setDuration(String duration) {
        this.duration = duration;
    }

    public float getModifiedAt() {
        return modifiedAt;
    }

    public void setModifiedAt(float modifiedAt) {
        this.modifiedAt = modifiedAt;
    }

    public float getCreatedAt() {
        return createdAt;
    }

    public void setCreatedAt(float createdAt) {
        this.createdAt = createdAt;
    }

    public Product() {
    }


    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(this.shopId);
        dest.writeString(this.id);
        dest.writeString(this.name);
        dest.writeInt(this.categoryId);
        dest.writeString(this.categoryName);
        dest.writeString(this.region);
        dest.writeFloat(this.price);
        dest.writeFloat(this.marketPrice);
        dest.writeString(this.unit);
        dest.writeString(this.intro);
        dest.writeString(this.cover);
        dest.writeParcelable(this.pics, flags);
        dest.writeInt(this.salesVolume);
        dest.writeLong(this.addTime);
        dest.writeInt(this.isPublish);
    }

    protected Product(Parcel in) {
        this.shopId = in.readString();
        this.id = in.readString();
        this.name = in.readString();
        this.categoryId = in.readInt();
        this.categoryName = in.readString();
        this.region = in.readString();
        this.price = in.readFloat();
        this.marketPrice = in.readFloat();
        this.unit = in.readString();
        this.intro = in.readString();
        this.cover = in.readString();
        this.pics = in.readParcelable(ProductImageList.class.getClassLoader());
        this.salesVolume = in.readInt();
        this.addTime = in.readLong();
        this.isPublish = in.readInt();
    }

    public static final Creator<Product> CREATOR = new Creator<Product>() {
        public Product createFromParcel(Parcel source) {
            return new Product(source);
        }

        public Product[] newArray(int size) {
            return new Product[size];
        }
    };

    @Override
    public Object clone() throws CloneNotSupportedException {
        return super.clone();
    }
}
